package com.hjl.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

/**
 * @author ServivE
 * @version 0.1
 * @className MyHttpAttributeListener
 * @description
 * @date 2024/7/26 19:54
 * @since jdk11
 */
//监听三大域对象的属性变化的
    @WebListener
public class MyHttpAttributeListener implements HttpSessionAttributeListener {
    public void attributeAdded(HttpSessionBindingEvent hbe) {
        System.out.println("sessionID===" + hbe.getSession().getId());
        System.out.println("新增的属性是：" + hbe.getName() + ",值是：" + hbe.getValue());
    }

    public void attributeRemoved(HttpSessionBindingEvent hbe) {
        System.out.println("sessionID===" + hbe.getSession().getId());
        System.out.println("删除的属性是：" + hbe.getName() + ",值是：" + hbe.getValue());
    }

    public void attributeReplaced(HttpSessionBindingEvent hbe) {

    }
}
